import { Component, OnInit } from '@angular/core';
import {ActivatedRoute, NavigationEnd, Router} from '@angular/router';
import 'rxjs/add/operator/filter';

@Component({
  selector: 'app-content',
  templateUrl: './content.component.html',
  styleUrls: ['./content.component.css']
})
export class ContentComponent implements OnInit {
  private title: string;
  private desc: string;

  constructor(private router: Router) { }

  ngOnInit() {
    this.router.events.filter(event => event instanceof NavigationEnd)
      .subscribe((event: NavigationEnd) => {
        if (event.url == '/studentManager') {
          this.title = '学生管理';
          this.desc = '这里是学生管理页面';
        }
        if (event.url.startsWith('/test01')) {
          this.title = '测试';
          this.desc = '这里是测试页面';
        }
      });
  }

}
